from selenium.webdriver.common.by import By

class CouponCouponTemplateLocator:
    # Promo Management 菜单
    promo_management_menu = (By.XPATH, "//div[contains(@data-menu-id,'PROMO_MANAGER')]")

    # Coupon Template菜单
    coupon_template_menu = (By.CSS_SELECTOR, '[path="/console/couponTemplate"]')

    # 菜单区域滚动条div
    scroll_arera_by_class_name = 'cre-sider-menu cre-sider-menu-open'

    # 创建coupon template按钮
    create_coupon_template_button = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[1]/div/button')
    # edit按钮
    edit_template_button = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[2]/div/div/div/div/div/table/tbody/tr[2]/td[11]/div/div[1]/div/button')
    # 操作按钮的3个点 ...
    actions_button = (By.XPATH, "//span[contains(@class,'anticon anticon-ellipsis table-operation-ellipsis')]")
    # copy按钮
    copy_template_button = (By.XPATH, '//span[text()="Copy"]')
    # distribute按钮
    distribute_button = (By.XPATH, '//span[text()="Distribute"]')
    # generate按钮
    generate_button = (By.XPATH, '//span[text()="Generate"]')
    #disable 按钮
    disable_button = (By.XPATH, '//span[text()="Disabled"]')
    #Enabled 按钮
    enable_button = (By.XPATH, '//span[text()="Enabled"]')
    enable_button_high_light = (By.XPATH, '(//li[contains(@class,"antd4-dropdown-menu-item antd4-dropdown-menu-item-only-child")])[2]')
    enable_button_not_high_light = (By.XPATH, "//li[contains(@class,'antd4-dropdown-menu-item antd4-dropdown-menu-item-disabled antd4-dropdown-menu-item-only-child')]")


    # 搜索框
    search_input = (By.XPATH, "//input[contains(@placeholder,'Coupon Template')]")
    # 搜索按钮
    # search_button = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[1]/div/span/span/span/button')
    search_button = (By.XPATH, "//button[contains(@class,'antd4-btn antd4-btn-default antd4-btn-icon-only antd4-input-search-button')]")



    # 第一个查询结果
    # first_search_result = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[2]/div/div/div/div/div/table/tbody/tr[2]/td[1]')
    first_search_result = (By.XPATH, "//div[contains(@class,'linkId___')]")


    # 第一个查询结果的coupon template的值
    first_search_result_coupon_template = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[2]/div/div/div/div/div/table/tbody/tr[2]/td[1]/div/div')
    # 第一个查询结果的百分比字段的值
    first_search_result_percent = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[2]/div/div/div/div/div/table/tbody/tr[2]/td[5]/div')
    # 第一个查询结果的固定金额的值
    first_search_result_fixed_amount = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[2]/div/div/div/div/div/table/tbody/tr[2]/td[6]/div')
    # 第一个查询结果的reuse的值
    first_search_result_reuse = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[2]/div/div/div/div/div/table/tbody/tr[2]/td[7]/div')
    # 第一个查询结果的Validation Period 的值
    first_search_result_validation_period = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[2]/div/div/div/div/div/table/tbody/tr[2]/td[8]/div')
    # 第一个查询结果的Billing Method 的值
    first_search_result_billing_method = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[2]/div/div/div/div/div/table/tbody/tr[2]/td[3]/div')
    # 第一个查询结果的Usable Product 的值
    first_search_result_usable_product = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[2]/div/div/div/div/div/table/tbody/tr[2]/td[4]/div')
    # 第一个查询结果的status 的值
    first_search_result_status = (By.XPATH, "//div[contains(@class,'status_enabled')]")


    # template 列表字段
    # Coupon Template
    coupon_template_list_coupon_template = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[1]')
    coupon_template_list_status = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[2]/div/span[1]')
    coupon_template_list_billing_method = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[3]')
    coupon_template_list_usable_product = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[4]')
    coupon_template_list_percent = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[5]')
    coupon_template_list_fixed_amount = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[6]')
    coupon_template_list_reuse = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[7]')
    coupon_template_list_validation_period = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[8]')
    coupon_template_list_generator = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[9]')
    coupon_template_list_generation_time  = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div/div[2]/div[2]/div/div/div/div/div/table/thead/tr/th[10]')

    ################################################## 创建coupon template页面
    # coupon template名称
    coupon_template_input= (By.XPATH, '//*[@id="templateName"]')
    coupon_template_input1 = (By.XPATH, '/html/body/div[1]/section/section/main/div/div/div/div[1]/div[3]/div/div/form/div[1]/div[2]/div[1]/div[2]/div/div/input')


    #coupon type, percent选项
    coupon_type_percent = (By.XPATH, '//*[@id="type"]/label[1]/span[1]/input')
    # Percent
    percent_input = (By.XPATH, '//*[@id="discRate"]')
    percent_input1 = (By.XPATH, '/html/body/div[1]/section/section/main/div/div/div/div[1]/div[3]/div/div/form/div[1]/div[2]/div[3]/div[2]/div/div/div/div/input')

    # coupon type, fixed amount选项
    coupon_type_fixed_amount = (By.XPATH, '//*[@id="type"]/label[2]/span[1]/input')
    # fixed amount
    fixed_amount_input = (By.XPATH, '//*[@id="money"]')

    #Reuse 开关
    reuse_button = (By.XPATH, '//*[@id="reuse"]')

    #Validation Type
    validation_type_fixed = (By.XPATH, '//*[@id="useDefaultValidityPeriod"]/label[1]/span[1]/input')
    validation_type_dynmic = (By.XPATH, '//*[@id="useDefaultValidityPeriod"]/label[2]/span[1]/input')

    #validation period 时间选择
    start_time_input = (By.XPATH, '//*[@id="effTime"]')
    end_time_input = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div[1]/div[3]/div/div/form/div[3]/div[2]/div[2]/div[2]/div/div/div/div[3]/input')

    start_time = (By.XPATH, '/html/body/div[3]/div/div/div/div[2]/div/div[1]/div/div[2]/table/tbody/tr[5]/td[7]/div')
    end_time = (By.XPATH, '/html/body/div[3]/div/div/div/div[2]/div/div[2]/div/div[2]/table/tbody/tr[5]/td[7]/div')

    #billing method下拉选择
    billing_method_select = (By.XPATH, '//*[@id="billingMethod"]')
    #all选项
    billing_method_select_all_selection = (By.XPATH, '/html/body/div[4]/div/div/div/div[2]/div/div/div/div[3]')
    billing_method_select_all_selection_1 = (By.XPATH, '/html/body/div[3]/div/div/div/div[2]/div/div/div/div[3]/div')

    #subscription选项
    billing_method_select_subscription_selection = (By.XPATH,  '/html/body/div[4]/div/div/div/div[2]/div/div/div/div[1]/div')

    #usable product下拉选择
    usable_product_select = (By.XPATH,  '//*[@id="root"]/section/section/main/div/div/div/div[1]/div[3]/div/div/form/div[3]/div[2]/div[4]/div[2]/div/div/div/div/div')
    # all选项
    usable_product_select_all_selection = (By.XPATH, '/html/body/div[5]/div/div/div/div[2]/div[1]/div/div/div[1]/div')
    usable_product_select_all_selection_1 = (By.XPATH, '/html/body/div[4]/div/div/div/div[2]/div[1]/div/div/div[1]/div')

    # 第一个产品的选项
    usable_product_select_first_selection = (By.XPATH, '(//div[@class="rc-virtual-list-holder-inner"])[2]/div[2]')

    # submit按钮
    submit_button = (By.XPATH, '//button//span[text() = "Submit"]')

    #################################################详情页面
    # template history 页签的第一条记录
    # Coupon Template的值
    first_history_coupon_template = (By.XPATH, '(//tr[contains(@class,"antd4-table-row antd4-table-row-level-0")])[1]//td[2]')
    # 第一个查询结果的coupon template的值
    first_history_coupon_template_result_bind = (By.XPATH, '(//tr[contains(@class,"antd4-table-row antd4-table-row-level-0")])[1]//td[7]')

    # distribute history 页签的第一条记录account_email
    first_distribute_history_account_email = (By.XPATH, '(//tr[contains(@class,"antd4-table-row antd4-table-row-level-0")])[1]//td[2]')


    ###########################################分配页面
    #Distribute To选项：account email, Promo Crowd
    # distribute_to_accunt_email = (By.XPATH,'//*[@id="distributeType"]/label[1]/span[1]/input')
    distribute_to_account_email = (By.CSS_SELECTOR, '[@value="ACCOUNT"]')
    distribute_to_promo_crowd = (By.CSS_SELECTOR, '[@value="GROUP"]')
    # promo crowd选择框
    promo_crowd_input = (By.XPATH, "//input[contains(@class,'antd4-select-selection-search-input')]")
    # account 输入框
    account_email_input = (By.XPATH, "//input[contains(@class,'antd4-select-selection-search-input')]")

    #promo crowd的第一个搜索结果
    # first_promo_crowd_seletion = (By.XPATH, '//div[text()="lwm_edithajmof"]')
    first_promo_crowd_selection = (By.XPATH, '/html/body/div[3]/div/div/div/div[2]/div/div/div/div[1]/div')
    # account email的第一个搜索结果
    first_account_email_selection = (By.XPATH, "//div[contains(@class,'antd4-select-item antd4-select-item-option antd4-select-item-option-active')]")

    # 分配按钮
    # distribute_button = (By.XPATH, '//*[@id="root"]/section/section/main/div/div/div/div[2]/div[1]/div/button[1]')
    # distribute_button = (By.XPATH, '//span[text()="Distribute"]')

    #disable 的ok按钮
    disable_ok_button = (By.XPATH, '//span[text()="OK"]')

    #状态筛选按钮
    status_filter_button = (By.XPATH, "//span[contains(@class,'anticon anticon-filter')]")
    status_filter_enabled_button = (By.XPATH, '(//input[contains(@class,"antd4-checkbox-input")])[1]')
    status_filter_disabled_button = (By.XPATH, '(//input[contains(@class,"antd4-checkbox-input")])[2]')
    status_filter_ok_button = (By.XPATH, '//span[text()="OK"]')


    ################generate 页面
    #Quantity 输入框
    quantity_input = (By.XPATH, "//input[contains(@id,'quantity')]")
    #Generate按钮
    # generate_button = (By.XPATH, '//span[text()="Generate"]')
    #Generate History 页签
    generate_history_tab = (By.XPATH, '//div[text()="Generate History"]')
    distribute_history_tab = (By.XPATH, '//div[text()="Distribute History"]')

    #查询结果的数据量
    search_result_num = (By.XPATH, "//li[contains(@class,'antd4-pagination-total-text')]")

    bind_filter_button = (By.XPATH, "//span[contains(@class,'antd4-dropdown-trigger antd4-table-filter-trigger')]")
    bind_filter_y_button = (By.XPATH, '(//input[contains(@class,"antd4-checkbox-input")])[1]')
    bind_filter_n_button = (By.XPATH, '(//input[contains(@class,"antd4-checkbox-input")])[2]')
    bind_filter_ok_button = (By.XPATH, '//span[text()="OK"]')
    bind_filter_reset_button = (By.XPATH, '//span[text()="Reset"]')























